package br.com.colegio.dao.storage;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import br.com.colegio.dao.BoletoStatusDAO;
import br.com.colegio.vo.BoletoStatus;

public class BoletoStatusData
{
	private static BoletoStatusData instance;
	private Map<String, BoletoStatus> data = new HashMap<String, BoletoStatus>(); 

	private BoletoStatusData()
	{
	}

	public static BoletoStatusData getInstance()
	{
		if (instance == null)
			instance = new BoletoStatusData();

		return instance;
	}

	public BoletoStatus getBoletoStatus(String cod)
	{
		if (data.size() == 0)
		{
			Collection<Object> r = BoletoStatusDAO.list();

			if (r != null)
				for (Object o : r)
				{
					BoletoStatus b = (BoletoStatus)o;
					data.put(b.getCodigo(), b);
				}
		}

		return data.get(cod);
	}
}